body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f0f0f0;
    margin: 0;
    perspective: 1000px; /* 3D效果的透视 */
}

.cube-container {
    transform-style: preserve-3d; /* 保持3D效果 */
    animation: rotate 5s infinite linear; /* 定义旋转动画 */
}

.cube {
    width: 200px;
    height: 200px;
    position: relative;
    transform-style: preserve-3d; /* 保持3D效果 */
    transform: rotateX(-20deg) rotateY(20deg); /* 初始旋转 */
}

.face {
    position: absolute;
    width: 200px;
    height: 200px;
    border: 1px solid #000;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: #000; /* 黑色文字 */
    backface-visibility: hidden; /* 隐藏背面 */
}

.front {
    transform: translateZ(100px);
    animation: colorChange 5s infinite;
}

.back {
    transform: rotateY(180deg) translateZ(100px);
    animation: colorChange 5s infinite;
}

.left {
    transform: rotateY(-90deg) translateZ(100px);
    animation: colorChange 5s infinite;
}

.right {
    transform: rotateY(90deg) translateZ(100px);
    animation: colorChange 5s infinite;
}

.top {
    transform: rotateX(90deg) translateZ(100px);
    animation: colorChange 5s infinite;
}

.bottom {
    transform: rotateX(-90deg) translateZ(100px);
    animation: colorChange 5s infinite;
}

@keyframes rotate {
    0% { transform: rotateX(0deg) rotateY(0deg); }
    100% { transform: rotateX(360deg) rotateY(360deg); }
}

@keyframes colorChange {
    0% { background-color: #fff; }
    25% { background-color: #ff0; }
    50% { background-color: #f0f; }
    75% { background-color: #0ff; }
    100% { background-color: #fff; }
}